

package com.hazelcast.client.impl.spi.impl.listener;

import com.hazelcast.client.impl.connection.ClientConnection;
import com.hazelcast.client.impl.spi.EventHandler;
import com.hazelcast.client.impl.spi.impl.ListenerMessageCodec;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class ClientListenerRegistration {

    private final ListenerMessageCodec codec;
    private final EventHandler handler;
    private final Map<ClientConnection, ClientConnectionRegistration> registrations = new ConcurrentHashMap<>();

    ClientListenerRegistration(EventHandler handler, ListenerMessageCodec codec) {
        this.handler = handler;
        this.codec = codec;
    }

    public ListenerMessageCodec getCodec() {
        return codec;
    }

    public EventHandler getHandler() {
        return handler;
    }

    Map<ClientConnection, ClientConnectionRegistration> getConnectionRegistrations() {
        return registrations;
    }

    @Override
    public String toString() {
        return "ClientListenerRegistration{" + "codec=" + codec + ", handler=" + handler + '}';
    }
}
